﻿using SmartPlant.Model.Biz;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SmartPlant.Core
{
    public class TagConvention2BoolConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool valid = true;
            System.Collections.ObjectModel.ObservableCollection<UnitTagConvention> a = value as System.Collections.ObjectModel.ObservableCollection<UnitTagConvention>;
            foreach (UnitTagConvention b in a) 
            {
                if (string.IsNullOrEmpty(b.Text))
                {
                    valid = false;
                    break;
                }
            }
            return valid;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
